package servlet;

import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import java.io.IOException;

@WebServlet("/MyServlet")
public class MyServlet extends HttpServlet {
    @Override
    public void service(ServletRequest req, ServletResponse res) throws ServletException, IOException {
        res.getWriter().println("your ip is: "+req.getRemoteAddr());
        res.getWriter().println("server ip is :" +req.getLocalAddr());
        System.out.println("this message is from: "+req.getRemoteAddr());
    }
}
